package com.luyuan.crm.formula.web;

import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;

import com.luyuan.crm.formula.model.Inventory;
import com.luyuan.crm.product.model.Product;
import com.luyuan.crm.product.model.ProductType;
import com.ruijie.web.jsf.action.BaseAction;

@Component("inventoryAction")
@Scope("view")
public class InventroyAction extends BaseAction {

    private Product product;

    private ProductType productType;

    private int count;

    private Boolean gift = false;

    public void addInventory() {
        Inventory inventory = new Inventory();
        inventory.setProduct(product);
        inventory.setName(product.getName());
        inventory.setSpecification(product.getSpecification());
        inventory.setQuantity(count);
        inventory.setGift(gift);
        setRequestAttribute("inventory", inventory, true);

        addGlobalI18nMessage("成功添加一条保健品信息");
    }

    public Product getProduct() {
        return product;
    }

    public void setProduct(Product product) {
        this.product = product;
    }

    public int getCount() {
        return count;
    }

    public void setCount(int count) {
        this.count = count;
    }

    public ProductType getProductType() {
        return productType;
    }

    public void setProductType(ProductType productType) {
        this.productType = productType;
    }

    public Boolean getGift() {
        return gift;
    }

    public void setGift(Boolean gift) {
        this.gift = gift;
    }

}
